export default {
  // 开启了命名空间
  namespaced: true,
  state: {
    name: 'jack',
    age: 18,
    skill: 'jump'
  },
  mutations: {
    setSKill (state, newSkill) {
      state.skill = newSkill
    },
    setName (state, newName) {
      state.name = newName
    }
  },
  getters: {
    isAdult (state) {
      return state.age >= 18 ? '成年啦' : '未成年'
    }
  },
  actions: {
    setNameAsync (context, newName) {
      setTimeout(() => {
        context.commit('setName', newName)
      }, 3000)
    }
  }
}
